<?php


namespace app\api\validate;


class DailyValidate extends BaseValidate
{
    protected $rule = [
        'org_id' => 'require|isPositiveInteger',
        'app_id' => 'require|isPositiveInteger',
        'time' => 'require|date',
        'charge_total' => 'require|isPositiveInteger',
        'charge_count' => 'require|isPositiveInteger',
        'draw_total' => 'require|isPositiveInteger',
        'draw_count' => 'require|isPositiveInteger',
        'users' => 'require|isPositiveInteger',
        'new_users' => 'require|isPositiveInteger',
        'active_users' => 'require|isPositiveInteger',
        'stock' => 'require|isPositiveInteger',
        'rooms' => 'require|isPositiveInteger',
        'give_total' => 'require|isPositiveInteger',
        'consume_total' => 'require|isPositiveInteger',
        'token' => 'require|length:32',
    ];

    /** 是否是正整数 */
    protected function isPositiveInteger($value, $rule='', $data='', $field='')
    {
        if(is_numeric($value) && $value>=0){
            return true;
        }else{
            return $field.'必须是非负整数';
        }
    }
}